/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "facturas", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Facturas.findAll", query = "SELECT f FROM Facturas f"),
    @NamedQuery(name = "Facturas.findByNrofac", query = "SELECT f FROM Facturas f WHERE f.nrofac = :nrofac"),
    @NamedQuery(name = "Facturas.findByFecha", query = "SELECT f FROM Facturas f WHERE f.fecha = :fecha"),
    @NamedQuery(name = "Facturas.findByTipo", query = "SELECT f FROM Facturas f WHERE f.tipo = :tipo"),
    @NamedQuery(name = "Facturas.findByMonto", query = "SELECT f FROM Facturas f WHERE f.monto = :monto"),
    @NamedQuery(name = "Facturas.findByIntervalo", query = "SELECT f FROM Facturas f WHERE f.intervalo = :intervalo"),
    @NamedQuery(name = "Facturas.findByCuotas", query = "SELECT f FROM Facturas f WHERE f.cuotas = :cuotas"),
    @NamedQuery(name = "Facturas.findByEstado", query = "SELECT f FROM Facturas f WHERE f.estado = :estado")})
public class Facturas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "Nro_fac", nullable = false)
    private Integer nrofac;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Size(max = 10)
    @Column(name = "tipo", length = 10)
    private String tipo;
    @Column(name = "monto")
    private Integer monto;
    @Column(name = "intervalo")
    private Integer intervalo;
    @Column(name = "cuotas")
    private Integer cuotas;
    @Size(max = 2)
    @Column(name = "estado", length = 2)
    private String estado;
    @JoinTable(name = "notarem_fact", joinColumns = {
        @JoinColumn(name = "Nro_fac", referencedColumnName = "Nro_fac", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "re_cod", referencedColumnName = "re_cod", nullable = false)})
    @ManyToMany
    private Collection<NotasRemi> notasRemiCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nrofac")
    private Collection<NotasDebCred> notasDebCredCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "facturas")
    private Collection<CtasCobrar> ctasCobrarCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "facturas")
    private Collection<Facxservicios> facxserviciosCollection;
    @JoinColumn(name = "cli_cod", referencedColumnName = "cli_cod", nullable = false)
    @ManyToOne(optional = false)
    private Clientes cliCod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "facturas")
    private Collection<DetFacturas> detFacturasCollection;

    public Facturas() {
    }

    public Facturas(Integer nrofac) {
        this.nrofac = nrofac;
    }

    public Integer getNrofac() {
        return nrofac;
    }

    public void setNrofac(Integer nrofac) {
        this.nrofac = nrofac;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Integer getMonto() {
        return monto;
    }

    public void setMonto(Integer monto) {
        this.monto = monto;
    }

    public Integer getIntervalo() {
        return intervalo;
    }

    public void setIntervalo(Integer intervalo) {
        this.intervalo = intervalo;
    }

    public Integer getCuotas() {
        return cuotas;
    }

    public void setCuotas(Integer cuotas) {
        this.cuotas = cuotas;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    @XmlTransient
    public Collection<NotasRemi> getNotasRemiCollection() {
        return notasRemiCollection;
    }

    public void setNotasRemiCollection(Collection<NotasRemi> notasRemiCollection) {
        this.notasRemiCollection = notasRemiCollection;
    }

    @XmlTransient
    public Collection<NotasDebCred> getNotasDebCredCollection() {
        return notasDebCredCollection;
    }

    public void setNotasDebCredCollection(Collection<NotasDebCred> notasDebCredCollection) {
        this.notasDebCredCollection = notasDebCredCollection;
    }

    @XmlTransient
    public Collection<CtasCobrar> getCtasCobrarCollection() {
        return ctasCobrarCollection;
    }

    public void setCtasCobrarCollection(Collection<CtasCobrar> ctasCobrarCollection) {
        this.ctasCobrarCollection = ctasCobrarCollection;
    }

    @XmlTransient
    public Collection<Facxservicios> getFacxserviciosCollection() {
        return facxserviciosCollection;
    }

    public void setFacxserviciosCollection(Collection<Facxservicios> facxserviciosCollection) {
        this.facxserviciosCollection = facxserviciosCollection;
    }

    public Clientes getCliCod() {
        return cliCod;
    }

    public void setCliCod(Clientes cliCod) {
        this.cliCod = cliCod;
    }

    @XmlTransient
    public Collection<DetFacturas> getDetFacturasCollection() {
        return detFacturasCollection;
    }

    public void setDetFacturasCollection(Collection<DetFacturas> detFacturasCollection) {
        this.detFacturasCollection = detFacturasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nrofac != null ? nrofac.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Facturas)) {
            return false;
        }
        Facturas other = (Facturas) object;
        if ((this.nrofac == null && other.nrofac != null) || (this.nrofac != null && !this.nrofac.equals(other.nrofac))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Facturas[ nrofac=" + nrofac + " ]";
    }
    
}
